import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class project {
    public int minEatingSpeed(int[] piles, int h) {
        int l=1;
        int r=1_000_000_000;
        while (l<r){
            int mid=(l+r)/2;
            if(find(piles,h,mid)){
                r=mid;
            }else{
                l=mid+1;
            }
        }
        return l;
    }
    public boolean find(int[] arr,int h,int k){
        int time=0;
        for(int i : arr){
            time+=(i-1)/k+1;
        }
        return time<=h;
    }











    public static void main(String[] args) {
        int x=(int)1e9;
        System.out.println(x);
    }








    public int minEatingSpeed1(int[] piles, int h) {
        int l=0;
        int r=1_000_000_000;
        while (l<r){
            int mid=(l+r)/2;
            if(find2(piles,h,mid)){
                l=mid+1;
            }else{
                r=mid;
            }
        }
        return l;
    }
    public boolean find2(int[] arr,int h,int k){
        int time=0;
        for(int i : arr){
            time+=(i-1)/k+1;
        }
        return time<=h;
    }



















    public int findRadius(int[] houses, int[] heaters) {
        Arrays.sort(heaters);
        Arrays.sort(houses);
        int l=0;
        int r=Integer.MAX_VALUE;
        while (l<r){
            int mid=(l+r)/2;
            if(find1(houses,heaters,mid)){
                r=mid;
            }else{
                l=mid+1;
            }
        }
        return r;
    }
    public boolean find1(int[] houses,int[] heaters,int index){
        int len1=houses.length;
        int len2=heaters.length;
        for(int i=0,j=0;i<len1;i++){
            while (j<len2&&houses[i]>heaters[j]+index){
                j++;
            }
            if(j<len2&&houses[i]<=heaters[j]+index&&houses[i]>=heaters[j]-index){
                continue;
            }
            return false;
        }
        return true;
    }
}
